<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增商户信息')" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
</head>
<style>
    .kv-upload-progress .progress-bar {
        height: 20px;
    }
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-shop-add">
        <div class="form-group">
            <label class="col-sm-2 control-label is-required">商户名称：</label>
            <div class="col-sm-4">
                <input name="shopName" class="form-control" type="text"
                       required maxlength="20">
            </div>
            <label class="col-sm-2 control-label is-required">法人：</label>
            <div class="col-sm-4">
                <input name="legalPerson" class="form-control" type="text"
                       required maxlength="30">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label is-required">商户电话：</label>
            <div class="col-sm-4">
                <input name="shopTelnum" class="form-control" type="text"
                       required maxlength="20">
            </div>
            <label class="col-sm-2 control-label is-required">法人电话：</label>
            <div class="col-sm-4">
                <input name="telnumber" class="form-control" type="text"
                       required maxlength="30">
            </div>
        </div>


        <div class="form-group">
            <label class="col-sm-2 control-label is-required">市区县：</label>
            <div class="col-sm-4">
                <div id="element1" class="row"
                     data-url="/file/cityData.json" data-selects="province,city,area" data-required="true"
                >
                    <div class="col-sm-4">
                        <select class="province form-control" data-first-title="选择省" name="province">
                            <option value="">请选择</option>
                        </select>
                    </div>
                    <div class="col-sm-4">
                        <select class="city form-control" data-first-title="选择市" name="city">
                            <option value="">请选择</option>
                        </select>
                    </div>
                    <div class="col-sm-4">
                        <select class="district form-control" data-first-title="选择地区"  name="district">
                            <option value="">请选择</option>
                        </select>
                    </div>
                </div>
            </div>

            <label class="col-sm-2 control-label">是否中心店：</label>
            <div class="col-sm-4">
                <div class="radio-box" th:each="dict : ${@dict.getType('sys_yes_no')}">
                    <input type="radio" th:id="${'isFocus_' + dict.dictCode}" name="isFocus"
                           th:value="${dict.dictValue}" th:checked="${!dict.default}">
                    <label th:for="${'isFocus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label is-required">详细地址：</label>
            <div class="col-sm-4">
                <input name="shopAddress" class="form-control" type="text" required>
            </div>

            <label class="col-sm-2 control-label">是否测评店：</label>
            <div class="col-sm-4">
                <div class="radio-box" th:each="dict : ${@dict.getType('sys_yes_no')}">
                    <input type="radio" th:id="${'isTests_' + dict.dictCode}" name="isTests"
                           th:value="${dict.dictValue}" th:checked="${!dict.default}">
                    <label th:for="${'isTests_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">经度：</label>
            <div class="col-sm-4">
                <input name="shopLng" class="form-control" type="number" required>
            </div>
            <label class="col-sm-2 control-label">最低消费：</label>
            <div class="col-sm-4">
                <input name="minTax" class="form-control" type="text" required>
            </div>

        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">纬度：</label>
            <div class="col-sm-4">
                <input name="shopLat" class="form-control" type="number" required>
            </div>
            <label class="col-sm-2 control-label">登录密码：</label>
            <div class="col-sm-4">
                <div class="input-group">
                    <input id="shoppwd" name="shoppwd" placeholder="请输入登录密码" class="form-control" type="password" th:value="${@config.getKey('sys.user.initPassword')}" required>
                    <span class="input-group-addon" title="登录密码,鼠标按下显示密码"
                          onmousedown="$('#password').attr('type','text')"
                          onmouseup="$('#password').attr('type','password')"><i class="fa fa-key"></i></span>
                </div>
            </div>

        </div>


        <div class="form-group">
            <label class="col-sm-2 control-label">商户图片：</label>
            <div class="col-sm-4">
                <input name="shopImg"  type="hidden">
                <input class="file" type="file" multiple data-min-file-count="1"
                       data-show-upload="false" data-show-remove="false"
                       accept="image/*" id="shopImg"
                >
            </div>
            <label class="col-sm-2 control-label">商户营业执照：</label>
            <div class="col-sm-4">
                <input name="shlicense"  type="hidden">
                <input class="file" type="file" multiple data-min-file-count="1"
                       data-show-upload="false" data-show-remove="false"
                       accept="image/*" id="shlicense"
                >
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">身份证正面：</label>
            <div class="col-sm-4">
                <input name="onIdencard"  type="hidden">
                <input class="file" type="file" multiple data-min-file-count="1"
                       data-show-upload="false" data-show-remove="false"
                       accept="image/*" id="onIdencard"
                >
            </div>
            <label class="col-sm-2 control-label">身份证反面：</label>
            <div class="col-sm-4">
                <input name="upIdencard"  type="hidden">
                <input class="file" type="file" multiple data-min-file-count="1"
                       data-show-upload="false" data-show-remove="false"
                       accept="image/*" id="upIdencard"
                >
            </div>
        </div>

    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-fileinput-js" />
<th:block th:include="include :: jquery-cxselect-js" />
<th:block th:include="include :: wxcos-upload-js" />

<script type="text/javascript">

    $('#element1').cxSelect({
        selects: ['province', 'city', 'district'],
        nodata: 'none'
    });

    var prefix = ctx + "operator/shop"
    $("#form-shop-add").validate({
        focusCleanup: true
    });

    $('input.file[type=file]').on("filebatchselected", function(event, files) {
        cosUpload.putPath(event, files[0])
    })

    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-shop-add").serializeArray();
            console.log(data)
            $.operate.save(prefix + "/add", data);
        }
    }

</script>
</body>
</html>
